
const TokenKey = 'ucen_template_token'

/**
 * @description 获取单点登录token
 */
export function treeToArray(tree) {
  if (tree !== null) {
    let result = [];
    tree.forEach(node =>{
      function traverse(node, result) {
        let item = Object.assign({}, node); // 复制节点信息
        result.push(item);
        
        if (Array.isArray(node.children) && node.children.length > 0) {
          node.children.forEach(child => {
            traverse(child, result); // 递归遍历子节点
          });
        }
      }
      traverse(node, result);
    })
    return result;
  }
}
